<template>
		<view class="startup">
			<view class="head">
				<image :src="start_bg2" mode="widthFix"></image>
				<view class="title" :style="">{{title}}</view>
				<view class="subtitle">{{subtitle}}</view>
				<view class="countdown" @click="jump">跳过({{count}}秒)</view>
			</view>
			<view class="logo">
				<image :src="logo" mode="heightFix"></image>
			</view>
		</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				start_bg2: '/static/img/start_bg2.png',
				title: '积分商城',
				subtitle: '海量商品 随心兑换',
				logo: '/static/img/logo.png',
				count: 10,									// 倒计时剩余秒数
				timer: null,								// 定时器
				top: 0,            							// 文字到顶部的距离
			};
		},
		computed: {},
		watch: {},
		methods: {
			countdown(){
				this.timer = setInterval(() => {
					this.count--
					if(this.count === 0){
						uni.navigateTo({
							url:"/pages/head_index/index"
						})
						this.count=10
						clearInterval(this.timer),
						this.timer=null
					}
				},1000)
			},
			jump(){
				console.log(1);
				uni.navigateTo({
					url:"/pages/head_index/index"
				})
			}
		},
		
		created() {
			let that =this 
			that.top = getApp().globalData.statusBarHeight * 2 + getApp().globalData.navHeight * 2 + 6 +'rpx'
		},
		mounted() {
			this.countdown()
		},
		beforeDestroy() {
			this.count=0
			clearInterval(this.timer)
			this.timer=null
		}
	}
</script>
<style scoped lang="scss">
@import "./index.scss";
</style>
